package com.thread;

public class TickWindow {
    private int count;

    public TickWindow(int count){
        this.count=count;
    }
    public synchronized int getCount(){
        return  count;
    }

    public synchronized int sell(int amount){
        if(this.count>=amount){
            this.count-=amount;
            return  amount;
        }else {
            return 0;
        }
    }
}
